//------------------------------------------------------------------------------------
#include "CFont.h"
#include "common.h"
//------------------------------------------------------------------------------------
static CFont * instance = 0;
//------------------------------------------------------------------------------------
CFont * CFont::getInstance(void) {
	if(instance == 0) {
		instance = new CFont();
	}

	return instance;
}
//------------------------------------------------------------------------------------
void CFont::draw(QPainter *painter, int value, int x, int y) {
	if(value >= 0 && value <= 9) {
		QRect reg(value*FONT_WIDTH, 0, FONT_WIDTH, FONT_HEIGHT);
	    painter->drawImage(QPoint(x, y), font.copy(reg));	
	}
}
//------------------------------------------------------------------------------------
CFont::CFont(void) {
    font=QImage(":/snake/images/font.png");
}
//------------------------------------------------------------------------------------


